﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Project.EPMAuditing.Library;
using System.IO;

namespace Microsoft.Office.Project.EPMAuditing.AuditListenerCatalog
{
    public abstract class AuditListener : IDisposable
    {
        private Tracing _tracing = null;

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        protected virtual void Dispose(bool disposing)
        {
            if (disposing)
            {
                // Free other state (managed objects).
            }
            // Free your own state (unmanaged objects).
            // Set large fields to null.
        }

        // Use C# destructor syntax for finalization code.
        ~AuditListener()
        {
            // Simply call Dispose(false).
            Dispose(false);
        }

        public Tracing TracingService
        {
            get{
                return _tracing;
            }
            set
            {
                _tracing = value;
            }
        }

        public abstract void Write(MemoryStream ms);

        //protected static ChangeRecord DeserializeMessage(MemoryStream message)
        //{
        //    return PSSerializer<ChangeRecord>.Deserialize(message);

        //}
    }
}
